package com.socio.utils;

import java.util.List;

import com.socio.model.Day;

/**
 * Class is responsible for loading fields for the object gotten from db
 * @author potlow
 *
 */
public class FieldLoader {

	public static enum FieldLoaderFields { DayUserAndroidUDID, DayUserFacebookID,
		DayUserNickname};
	
	/**
	 * Access fields so they can be used once the PersistenceManager is close
	 * @param object object to get fields for
	 * @param fields fields 
	 */
	public static void loadFields(Object object, List<FieldLoaderFields> fields) {
		
		if(fields == null)
			return;
		
		Day day;
		for(FieldLoaderFields field : fields) {
			switch(field) {
			case DayUserAndroidUDID:
				day = (Day)object;
				day.getUser().getAndroidUDID();
				break;
			case DayUserFacebookID:
				day = (Day)object;
				day.getUser().getFacebookID();
				break;
			case DayUserNickname:
				day = (Day)object;
				day.getUser().getNickname();
				break;
			}
		}
	}
}
